<?php
$id=$_GET['id'];
$title1=$_GET['title'];
$author1=$_GET['author'];
$web1=$_GET['web'];
$connect=mysql_connect("localhost","root","192510");
mysql_select_db("news",$connect);
$sql="select * from news where id='{$id}'";
$result = mysql_query($sql);
$row=mysql_fetch_array($result);
?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
<link href="css/style.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="js/jquery-1.6.3.min.js"></script>
</head>

<body>

	<div class="place">
    <span>位置：</span>
    <ul class="placeul">
    <li><a href="#">新闻管理</a></li>
	<?php
	 if($id==null){
	?>
	  <li><a href="#">添加新闻</a></li>
	 <?php
	 }else{
	 ?>
      <li><a href="#">编辑新闻</a></li>
     <?php	 
	 }
	?>
   
    </ul>
    </div>
    
    <div class="formbody">
    
    <div class="formtitle"><span>基本信息</span></div>
    <form method="post" action="insert_new_commit.php">
    <ul class="forminfo">
    <li><label>标题</label><input  name="title" onblur="new_name();"   id="title" class="dfinput" /><i style="margin-right:20px;display:none;" id="yz_title">标题不能为空</i></li>
    <li><label>网站</label>
	<?php
		if($id==null){    //新增
	?>
	   <input type="test" name="web" disabled="true"  id="web" class="dfinput" size="35" value="无"/>  
    <?php  
	}else{  //修改
				  
	?> 
       <input type="test" name="web" disabled="true"  id="web" class="dfinput" size="35" value="无"/>  			
    <?php	
	}	
	?>
	</li>
    <li><label>作者</label><input  type="text" class="dfinput" name="author" id="author"/></li>
    <li><label>内容</label><textarea  name="content" id="content" style="width:350px;height:80px;overflow-y:visible" class="textinput"></textarea></li>
	<li><label>链接</label><input type="text" class="dfinput"  name="link" id="link"/></li>
    <li><label>&nbsp;</label><input  type="submit" class="btn" value="确认保存" onclick="return tijiao();"/></li>
    </ul>
	</form>
    </div>
</body>
</html>
<script>
       
 function new_name(){
		   var title=$("#title").val();
		   if(title==null||title.length==0){
			   $("#yz_title").show();
		   }else{
			    $("#yz_title").hide();
		   }	   
 }

function tijiao(){
		 
		     var title=$("#title").val();
			 if(title==null||title.length==0){
				 alert("新闻名不能为空");
				 return false;
				 
			 }else{
				 
				 return true;
			 }
		   
		   
		   
	   }

</script>